Computer systems may include a variety of devices. These devices may include not only what is typically thought of as a “computer” (e.g., a PC or other general-purpose computer) but also peripheral devices that enhance the functionality of the computer. Peripheral devices may perform a number of functions, such as printing, communication, user input/output (I/O), data storage, and so on.
In one exemplary system, a general-purpose computer or workstation may be connected to a tape drive. The tape drive provides a means to back up the data of the general-purpose computer so that the data will not be lost in the event of a failure of the general-purpose computer. In this particular system, the tape drive is configured to communicate with the general-purpose computer using a protocol called the small computer system interface (SCSI) protocol.
Typically, the tape drive is connected directly to the computer via a SCSI transport medium. In communications between the computer and the tape drive, the computer acts as an initiator, while the tape drive acts as a target. In other words, the computer initiates communications, typically by sending a command to the tape drive, while the tape drive is the device that is targeted by the command. Because the tape drive may not always be ready to respond to commands initiated by the computer, the tape drive is configured to provide notifications (that are typically referred to as “unit attentions”) to the computer to let the computer know that the tape drive cannot perform the command or otherwise provide the response requested by the computer.
Unit attentions may be provided in a number of situations. For example, it may be necessary for the tape drive to provide a unit attention to the computer when the media (tape) has been changed, when the tape drive has been reset or power cycled, and so on. The unit attentions may identify the particular bases for the unit attentions so that the computer can adapt its commands or requests appropriately. For example, if the computer sends a command to the tape drive to access a particular tape, that tape may have been replaced by another tape, so the tape drive may provide a unit attention to the computer identifying the media change. The computer then knows that it must request the desired tape before the tape can be accessed.
If the tape drive had been powered down and then powered up again, a unit attention indicating the power cycling of the tape drive would be provided to the computer. Upon receiving the unit attention, the computer would be aware that it could not assume the validity of any previously used settings for the tape drive. The computer could therefore check these settings before continuing to communicate with the tape drive.
In some systems, a peripheral device such as a tape drive may be used by more than a single computer. In one exemplary system, multiple host computers are coupled to a router, which is in turn coupled to the tape drive. The router directs communications from the host computers to the tape drive and returns responses from the tape drive to the appropriate one of the host computers. Again, these communications are subject to the unit attentions that may be provided by the tape drive.
In the multiple-host scenario, the conventional use of unit attentions may cause several problems. Normally, unit attentions are provided by the tape drive in response to commands from an initiator (e.g., one of the host computers). Because there are multiple host computers, a particular unit attention provided by the tape drive in response to a command from a particular one of the host computers is received by the router and forwarded to this particular computer. The unit attention is not immediately forwarded to the other host computers, but is instead stored in the router and is forwarded to each of the other host computers when a command to the tape drive is received from each of these host computers.
A number of unit attentions may be generated by the tape drive and stored by the router during a period of inactivity by a particular host computer. When this host computer finally sends a command to the tape drive, it will receive the first of the stored unit attentions in response to the command. Upon resending the command, it will receive the next of the stored unit attentions. There may be enough unit attentions stored in the router that the host computer will receive a threshold number of unit attentions and consequently assume the tape drive has malfunctioned.
Even if the host computer does not assume that the tape drive has malfunctioned, it may be forced to waste time and resources re-sending the desired command just to exhaust all of the unit attentions stored for it in the router. This is inefficient because it typically is not necessary for all of these accumulated unit attentions to be presented to the host computer. For example, if, while a first host computer is inactive, there are several media changes resulting from communications with a second host computer, there may be multiple media-change unit attentions stored in the router for the first computer. When the first host computer sends a command to the tape drive, it only needs to receive one of the media-change unit attentions. The remainder of these unit attentions are redundant. Nevertheless, each of these unit attentions is provided to the first host computer in response to a subsequent command.